public class Solution {
    public String convertToTitle(int columnNumber) {
        StringBuffer sb = new StringBuffer();
        while (columnNumber > 0) {
            int a0 = (columnNumber - 1) % 26 + 1;
            sb.append((char)(a0 - 1 + 'A'));
            columnNumber = (columnNumber - a0) / 26;
        }
        return sb.reverse().toString();
    }

    public static void main(String[] args) {
        Solution solution = new Solution();

        // 测试用例
        int[] testCases = {1, 28, 701, 2147483647};

        for (int testCase : testCases) {
            String result = solution.convertToTitle(testCase);
            System.out.println("Column Number: " + testCase + " -> Excel Column Title: " + result);
        }
    }
}